<?php ob_start() ?>

<div class="row">
    <?php if (isset($_SESSION['publicidad_msj'])) { ?>
        <div class="alert alert-success alert-dismissable col-lg-12 text-center">
            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
            <strong><?php echo $_SESSION['publicidad_msj'] ?></strong>
        </div>
        <?php
        unset($_SESSION['publicidad_msj']);
    }
    ?>
    <div class="col-lg-12">
        <h1>Sitios <small>Listado Sitios</small></h1>
    </div>
</div>
<hr>
<div class="row">
    <div class="col-lg-12">
        <?php if ($_SESSION['weokey_publicidad_tipo_usuario'] == md5('administrador')) { ?>
            <a class="btn btn-primary" href="registro_sitio"><i class="fa fa-plus-circle"></i> Nuevo Sitio</a>
            <hr>
        <?php } ?>
        <div class="panel panel-primary">
            <div class="panel-heading">
                <h3 class="panel-title"><i class="fa fa-globe"></i> Sitios</h3>
            </div>
            <div class="panel-body">
                <div class="table-responsive">
                    <table class="table table-bordered table-hover table-striped tablesorter" id="dataTables-example">
                        <thead>
                            <tr>
                                <th>Nombre <i class="fa fa-sort"></i></th>
                                <th>Descripción <i class="fa fa-sort"></i></th>
                                <th>URL <i class="fa fa-sort"></i></th>
                                <th>Acciones</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php //print_r($params_clientes) ?>
                            <?php foreach ($params_sitios as $fila) { ?>
                                <tr>
                                    <td><?php echo $fila['nombre'] ?></td>
                                    <td><?php echo $fila['descripcion'] ?></td>
                                    <td><a href="<?php echo $fila['url'] ?>" target="_blank" title="<?php echo $fila['nombre'] ?>"><?php echo $fila['url'] ?></a></td>
                                    <?php if ($_SESSION['weokey_publicidad_tipo_usuario'] == md5('administrador')) { ?>
                                        <td align="center"><a href="ver_sitio/<?php echo $fila['id'] ?>"><i class="fa fa-search"></i></a> <a href="modificar_sitio/<?php echo $fila['id'] ?>"><i class="fa fa-edit" title="Modificar"></i></a> <a href="eliminar_sitio/<?php echo $fila['id'] ?>"><i class="fa fa-trash-o" title="Eliminar"></i></a></td>
                                    <?php } else { ?>
                                        <td align="center"><a href="ver_sitio/<?php echo $fila['id'] ?>"><i class="fa fa-search"></i></a></td>

                                    <?php } ?>
                                </tr>
                            <?php } ?>
                        </tbody>
                    </table>
                </div> 
            </div>
        </div>
        <!--
        <hr>
        <a class="btn btn-primary" href="registro_tarifa"><i class="fa fa-plus-circle"></i> Nueva Tarifa</a>
        -->
    </div>

    <?php
    $contenido = ob_get_clean();
    include "app/templates/$template.php";
    ?>